package us.icitap.commandcenter.business.ejb.persistence;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

//@Entity
//@Table(name="CALL_STATUS_HISTORY",schema="MPC")
//@TableGenerator(name="STATUS_HISTORY_IDS",table="AUTO_IDS",valueColumnName="LAST_ID",initialValue=1, allocationSize=1)
public class CallStatusHistory implements Serializable {

	@Id
	@GeneratedValue(strategy=GenerationType.TABLE,generator="STATUS_HISTORY_IDS")
	@Column(nullable = false)
	private Integer id;
	
	@ManyToOne
	@JoinColumn(name="CALL_ID")
	private Call call;
	
	@Enumerated(EnumType.STRING)
	private CallStatusEnum status;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="STATUS_DATE")
	private Date statusDate;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Call getCall() {
		return call;
	}

	public void setCall(Call call) {
		this.call = call;
	}


	public Date getStatusDate() {
		return statusDate;
	}

	public void setStatusDate(Date statusDate) {
		this.statusDate = statusDate;
	}


	public CallStatusEnum getStatus() {
		return status;
	}

	public void setStatus(CallStatusEnum status) {
		this.status = status;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((call == null) ? 0 : call.hashCode());
		result = prime * result + ((status == null) ? 0 : status.hashCode());
		result = prime * result
				+ ((statusDate == null) ? 0 : statusDate.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CallStatusHistory other = (CallStatusHistory) obj;
		if (call == null) {
			if (other.call != null)
				return false;
		} else if (!call.equals(other.call))
			return false;
		if (status != other.status)
			return false;
		if (statusDate == null) {
			if (other.statusDate != null)
				return false;
		} else if (!statusDate.equals(other.statusDate))
			return false;
		return true;
	}


	
	
}
